<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<!-- <script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script> -->
<script src="./react.development.js"></script>
<script src="./react-dom.development.js"></script>
<script src="./babel.min.js"></script>
<script src="./prop-types.js"></script>
</head>
<body>
<div id="example"></div>
<div id="example1"></div>
<div id="example2"></div>
<div id="example3"></div>
<script type="text/babel">
class Person extends React.Component{
	render(){
		//console.log(this.props)
		return (
			<ul>
				<li>姓名：{this.props.username}</li>
				<li>年龄：{this.props.age}</li>
				<li>性别：{this.props.sex}</li>
			</ul>
		)
	}
}
//设置默认属性
Person.defaultProps = {
	sex:'无'
};
//设置属性默认类型
Person.propTypes = {//独立库
	username:PropTypes.string.isRequired,
	sex:PropTypes.string.isRequired,
};
let person = {
	username:'kobe',
	age:39,
	sex:'男'
};
ReactDOM.render(<Person username={person.username} age={person.age} sex={person.sex}/>,document.getElementById('example'))
ReactDOM.render(<Person age={person.age}/>,document.getElementById('example1'))
</script>
</body>
</html>